import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;

public class Test10 {

	public static void main(String[] args) {
		File file = new File(
				"C:\\Users\\19181\\Documents\\Tencent Files\\h.y\\a.txt");
		FileWriter f1 = null;
		BufferedWriter f2 = null;
		try {
			file.createNewFile();
			f1 = new FileWriter(file);
			f2 = new BufferedWriter(f1);
			int sum = 0;
			for (int i = 1; i < 10000; i++) {
				if (getNum(i) == 1) {
					f2.write(i + "\t");
					sum++;
					if (sum % 10 == 0) {
						f2.newLine();
					}
				}
			}
		} catch (IOException e) {
			e.printStackTrace();
		} finally {
			try {
				f2.flush();
				if (f1 != null)
					f1.close();

			} catch (IOException e) {
				// TODO Auto-generated catch block

				e.printStackTrace();
			}
		}

	}

	public static int getNum(int num) {
		int sum = 0;
		for (int i = 1; i < num; i++) {
			if (num % i == 0) {
				sum++;
			}
		}
		return sum;

	}

}
